

#include <iostream>
#include <vector>
using namespace std;

struct TreeNode 
{
    int val;
    TreeNode *left;
    TreeNode *right;
    TreeNode() : val(0), left(nullptr), right(nullptr) {}
    TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
    TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
};
 
class Solution
{
    using Node = TreeNode;
    vector<int> path;
    vector<vector<int>> res;

public:
    void wiggleSort(vector<int>& nums)
    {
        int n = nums.size();

        if (n < 3)
            return;

        for (int i = 1; i < n; ++i)
        {
            if ((i % 2) && nums[i] > nums[i - 1])
                swap(nums[i - 1], nums[i]);
            if (!(i % 2) && nums[i] < nums[i - 1])
                swap(nums[i - 1], nums[i]);
        }
    }

    vector<vector<int>> pathSum(TreeNode* root, int targetSum)
    {
        path.reserve(5e3);
        res.reserve(5e3);
        int pathsum = 0;

        _pathSum(root, targetSum, pathsum);

        return res;
    }

private:
    void _pathSum(Node* root, const int targetSum, int& path_sum)
    {
        if (!root)
            return;

        path.push_back(root->val);
        path_sum += root->val;
        _pathSum(root->left, targetSum, path_sum);
        _pathSum(root->right, targetSum, path_sum);

        if (!root->left && !root->right && path_sum == targetSum)
            res.push_back(path);
        path.pop_back();
        path_sum -= root->val;
    }
};

int main()
{

	return 0;
}